// // import parseTime, formatTime and set to filter
export { parseTime } from '@/utils'
export function moneyToyuan (val = 0) {
  return parseFloat((val / 100).toFixed(2))
}
/**
 *  手机号中间用*
 * @param {*} phone
 */
export function formatPhone (phone) {
  return phone.replace(/^(\d{3})\d{4}(\d+)/, '$1****$2')
}

/**
 * 权益包列表只有一个时返回第一个权益包名字
 * @param {Array} list
 * @param {Boolean} isReplace
 * @param {String} defaultText
 * @returns String
 */
export function importantPackageName (list, isReplace, defaultText = '') {
  let text = (list.length === 1 && list[0].name) || ''
  if (isReplace) {
    text = text.replace(/权益(包)?/, '')
  }
  return text || defaultText
}
